package com.jcp.service.imple;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jcp.dao.PayAlibaba;
import com.jcp.entity.Parment;
import com.jcp.util.LayuiData;

import tk.mybatis.mapper.entity.Example;
@Service
public class PayAlibabaServiceImpl implements com.jcp.service.PayAlibabaService {
	
	@Autowired
	private PayAlibaba payalibaba;
	
	
	@Override
	public LayuiData<Parment> selectRecordByPage(int page, int limit, String strLike) {
		// TODO Auto-generated method stub
		//开启分页方法
		PageHelper.startPage(page, limit);
		//创建Example对象
		Example ex = new Example(Parment.class);
		//进行模糊查询的集合
		ex.createCriteria().andLike("carNumber", strLike+"%");
		//获取集合
		List<Parment> list =payalibaba.selectByExample(ex);
		//创建PageInfo对象
		PageInfo<Parment> pageInfo=new PageInfo<Parment>(list);
		//将数据存储进LayuiData这个类中
		LayuiData<Parment> Id=new LayuiData<>(0,"",(int)pageInfo.getTotal(),pageInfo.getList());
		return Id;
	}

}
